/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 adv_object_flag.h

	$Header: /heroes4/adv_object_flag.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( ADV_OBJECT_FLAG_H_INCLUDED )
#define ADV_OBJECT_FLAG_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "abstract_bitmap_typedef.h"
#include "adv_object_image.h"
#include "cached_ptr.h"
#include "screen_point.h"
#include "sized_int_types.h"

class t_animation;
enum  t_player_color;

// --------------------------------------------------------------------------
// t_adv_object_flag class
// --------------------------------------------------------------------------

class t_adv_object_flag : public t_adv_object_subimage
{
public:
	// Static member functions
	static t_screen_rect const &	get_flag_extent();

	// Constructor/Destructor
	t_adv_object_flag(
		t_player_color			color,
		t_screen_point const &	offset,
		int						depth_offset );
	~t_adv_object_flag();

	// Member functions
	int						compute_frame( t_uint32 time ) const;
	virtual void			draw_to(
								int						frame_num,
								t_screen_rect const &	source_rect,
								t_abstract_bitmap16 &	dest,
								t_screen_point const &	dest_point,
								int						alpha = 15 ) const;
	virtual void			draw_to(
								int						frame_num,
								t_abstract_bitmap16 &	dest,
								t_screen_point const &	dest_point ) const;
	t_player_color			get_color() const;
	virtual int				get_depth_offset() const;
	int						get_frame_count() const;					
	virtual t_screen_rect	get_rect() const;
	virtual t_screen_rect	get_rect( int frame_num ) const;
	bool					hit_test(
								int						frame_num,
								t_screen_point const &	point ) const;
	virtual bool			is_underlay() const;
	void					set_color( t_player_color new_color );

private:
	// Data members
	t_cached_ptr< t_animation >	m_animation_ptr;
	t_player_color				m_color;
	t_screen_point				m_base_point;
	t_screen_point				m_offset;
	int							m_depth_offset;
	t_uint32					m_time_offset;

	// Member functions
	t_uint32	pick_time_offset() const;
};

// --------------------------------------------------------------------------
// t_adv_object_flag inline members
// --------------------------------------------------------------------------

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
inline t_player_color t_adv_object_flag::get_color() const
{
	return m_color;
}

#endif // !defined( ADV_OBJECT_FLAG_H_INCLUDED )
